﻿mainModule.factory('dictionaryCacheSvc', ["$cacheFactory", "$http", function ($cacheFactory, $http) {
    "use strict";
    var cache = $cacheFactory('dictionaryCache');
    function get(dictionary, id) { return cache.get(dictionary + "-" + id); };
    function put(dictionary, id, value) { cache.put(dictionary + "-" + id, value); };

    return {
        init: function (list) {
            var i;
            if (typeof (list) !== "undefined")
                for (i = 0; i < list.length; i++) {
                    put(list[i].DictionaryName, list[i].Id, list[i].Name);
                }
        },
        get: get,
        put: put
    }
}]);